Thumb

Update Statement within the Stored Procedure

9/14/2020 7:14:01 AM

Update Statement within the Stored Procedure: In this code we create Update stored procedure for Update the data into salary table by id then we Update the values by EXEC the stored procedure then gets the data by before create the GetData stored procedure. Now given bellow the example code:

/*CREATE PROCEDURE*/
CREATE PROCEDURE UpdateData
AS
BEGIN
SET NOCOUNT ON
UPDATE Salary
SET FirstName = 'Samanzer', LastName ='Ashgher',Gendar = 'Female', Salary ='35000',Department = 'BBA' WHERE Id = 5;
END
/*Update data*/
EXEC [dbo].[UpdateData]
/*show data*/
EXEC [dbo].[GetData]

In this code we create Update procedure then update the data where id=5 then show all data by  GetData stored procedure.